home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The PC-SIG Library 10
/
The PC-Sig Library - Shareware for the IBM PC and Compatibles (PC-SIG)(Tenth Edition Disks 1-2804)(1991).iso
/
PC_SIGCD
/
02
/
1
/
DISK0217.ZIP
/
NELIST.DOC
< prev
next >
Wrap
Text File
|
1984-12-23
|
11KB
|
331 lines
NELIST Pascal LISTER
Not copyright. Enjoy
Borland's TURBO Pascal comes with an unadvertised source
lister called "TLIST." Unfortunately, it doesn't quite work: at
least, on my printer (an Epson FX-80), it gets the page length
wrong. This program does some of the things TLIST was supposed
to do, to wit:
- It lists a file with headers, including the date on page 1
and page numbers on subsequent pages.
- If desired, it marks the reserved words with underlining or
boldface.
- If desired, it numbers the lines.
- It will paginate automatically, but you can insert symbols
in the file to control page breaks.
In addition, if you leave the reserved words unmarked, NELIST
will do a nice job of listing any sort of plain ASCII file. Un-
like TINST, however, NELIST will not automatically insert the
text of files called with the {$Ifilename} command, nor does it
give you any choice of page headers.
The Files:
NELIST.DOC is the documentation you are now reading.
NELIST.COM is the working compilation. You run it from DOS.
RESWORDS.TXT contains the list of reserved words NELIST uses if
you ask it to mark reserved words in the listing. It must be
on the default disk when you run NELIST.
NEPRN.DAT contains the printer control codes which NELIST uses
when it numbers the lines or marks the reserved words. As it
comes, it contains the codes for an Epson FX-80, but it may
be changed by means of NEINST. It must be on the default
drive when you run NELIST.
NEINST.COM is an installation program to put the proper print
control symbols in NEPRN.DAT. You don't need it to run
NELIST. It's only required if you have to adapt NELIST for
your printer.
NELIST.DOC Page 2
NELIST.PAS is the source code for NELIST.COM. You'll need it if
you have to recompile for a non-IBM machine.
NEINST.PAS contains the source code for NEINST.COM.
Running NELIST
To run NELIST, you must have the two files, RESWORDS.TXT and
NEPRN.DAT on the default disk. From DOS, run NELIST. It will
ask you for the date and the file you want to list. If you give
no extension, it will default to .PAS. It will ask you to con-
firm the file name you give it and check whether the file ex-
ists. Then it offers you some choices about how you want it
printed. You must supply two characters:
- L will make it number the lines (and use elite type to keep
the lines from folding).
- U makes it underline the reserved words.
- E makes it boldface the reserved words. (You can't have
both underlining and boldface.)
- If you don't want these things, enter a blank instead of the
letter. Two blanks make it print plain. (This option is
handy for printing any sort of text file, paginated, with
NELIST's headers.)
It's very good about checking your choices, explaining your
errors, and letting you change your mind.
Pagination
If not otherwise instructed, NELIST will paginate automat-
ically. If you want to control page breaks, put the following
symbols in the file:
- {.PA} produces an absolute page advance. The line on which
the symbol appears will be the first line of the new page.
- {.CPnn} (where nn is a number) makes a conditional page
break. If there isn't room for nn lines, it will start a
new page at that point. If you look at the source code in
NELIST.PAS, you'll see it peppered with these to keep each
procedure whole.
NELIST.DOC Page 3
Adapting NELIST
As it comes, NELIST is designed to print source files from
TURBO Pascal (Versions 1.00 or 2.00) on an Epson FX-80 from an
IBM PC. If that's what you want to do, you can use NELIST.COM as
it is. It can be adapted for other printers by changing the
print control symbols in NEPRN.DAT. See the instructions for
other printers, below, for doing this. There should be no
difficulty in using NELIST.COM with other Pascals (see below).
If you're using a non-IBM MS-DOS machine, you may have to compile
from NELIST.PAS and NEINST.PAS to make suitable .COM files. I
think you could do the same if you're running TURBO Pascal in a
CP/M version.
For Other Pascals:
The only Pascal I'm familiar with is Borland's TURBO Pascal.
As it comes, if your source code is in plain ASCII text files,
the only difficulty about other Pascals (or, for that matter,
other languages) ought to be the list of reserved words. NELIST
would print the file, but it would mark only words reserved in
TURBO (versions 2.00 or earlier).
The list of reserved words is in the file RESWORDS.TXT, so
all you need to do is rewrite the RESWORDS.TXT file to contain
your Pascal's reserved words. Any text editor which makes plain
ASCII files will do. Just make sure to
- Put one word on each line.
- Use lower case.
- Include no blanks.
The order doesn't matter. NELIST can handle up to 100 reserved
words (there are 43 in TURBO 1.00, 44 in TURBO 2.00) and the
words may be up to 10 characters long. If you need more than
that, you'll have to rewrite the source code. The only things
you'd have to change are the declarations at the beginning. They
are identified with comments.
For Other Printers:
On an Epson MX or an IBM printer, the underline and boldface
feature will work, but the line numbering will not be quite
right, because it calls for elite type, which these printers do
not have. Therefore, long lines will fold. If you write long
NELIST.DOC Page 4
lines and want them numbered, you should use NEINST to change the
print control symbols in NEPRN.DAT to call for condensed print.
For other printers, you will have to consult your printer
manual to see what to insert. Again, use NEPRN.DAT to change the
data in NEPRN.DAT.
Changing Print Control Symbols with NEINST
NELIST assumes that your printer can be made to underline, to
boldface (by "double-strike" &/or some other means), and to com-
press its type (at least to 12-character-per-inch "elite") by
sending it control codes of 1 to 3 characters. These characters
must be in the data file, NEPRN.DAT, on the default drive when
you run NELIST. Eight print control strings are required, start
and stop for each of the following:
1. Underlining
2. Double-strike
3. Emphasized type
4. Elite (or condensed, or some other small) typeface
Further, it needs to be told whether your printer will feed out a
new page when it's sent a CHR #12 ("FF") and, if not, how many
lines it puts on a page.
Look these up in your printer manual. "Emphasized" is a
boldface type which the Epson FX's offer which is usually nicer
than double-strike. If you don't have such a thing, use double-
strike for both. Work out the ASCII numbers for those instruc-
tions. NEINST requires the numbers, it can't accept characters.
Thus, to enter "Escape G", you would use the numbers, 27, 71. 27
is the ASCII number for "Escape", and 71 is the number for "G".
When you know what numbers you're going to need, put NEPRN.DAT on
the default drive, and run NEINST.
Since it is a .COM file, NEINST, like NELIST runs straight
from DOS. When you run it, NEINST goes through the set of
printer instructions, one by one. It will show you what is cur-
rently in the data file and ask whether it's Okay. To make a
change, type N, and it will ask what you want for that instruc-
tion. You can use up to three ASCII numbers per instruction.
Enter the proper sequence of numbers (NUMBERS, not characters),
separating them with commas. Since this is a nuisance to go
through, NEINST will confirm the numbers you've entered before
finally accepting it. Make sure it's got the right numbers. If
you've tried to enter a character instead of a number, NEINST
NELIST.DOC Page 5
will get it wrong. It's worth noting that NEINST doesn't actu-
ally rewrite the file until it has all of the codes. If you
panic and Ctrl-Break out of the program, it won't have changed
the data file.
If you happen to run NEINST without NEPRN.DAT on the default
disk, no matter. It won't have any current data to show you, but
it will go ahead and ask for the numbers you want, and create a
new NEPRN.DAT file on the default disk.
Programmer: R. N. Wisan, June, 1984
37 Clinton Street, Oneonta, NY, 13820